﻿/*function showMorePic(){
	$("#moreSelectPic").slideToggle("slow");
}*/
function changDefaultDisplayPicture(pic){
	$("#paticipatePicture").attr("src",pic);
}
/*function showHidden(a){
	if(a==1){
		$("#picture").show("slow");
		$("#uploadPic").hide("slow");
		$("#deletePic").hide("slow");
	}else if(a==2){
		$("#picture").hide("slow");
		$("#uploadPic").show("slow");
		$("#deletePic").hide("slow");
	}else if(a==3){
		$("#picture").hide("slow");
		$("#uploadPic").hide("slow");
		$("#deletePic").show("slow");
	}
}*/
function deletePicture(){
	if(confirm("确认删除吗？")){
		$.getJSON("deleteShowPicture.action",{
			picture:$("#paticipatePicture")[0].src,
			id:$("#hiddenparticipateid").val(),
			type:$("#hiddenparticipatetype").val()
		},function(data){
			if(data.flag==1){
				//alert("删除成功");
				$.weeboxs.open('删除成功!', {
					title:'提示',
					timeout:5,
					showCancel:false,
					okBtnName: '确定',
				});
				refreshShowPicture();
			}
			if(data.flag==0){
				//alert("不能删除默认图片");
				$.weeboxs.open('不能删除默认图片!', {
					title:'提示',
					timeout:5,
					showCancel:false,
					okBtnName: '确定',
				});
			}
		});
	}
}
/*function refreshShowPicture(){
	$.getJSON("getShowPicture.action",{
		id:$("#hiddenparticipateid").val(),
		type:$("#hiddenparticipatetype").val()
	},function(data){
		alert(data.slist);
	});
}*/

function changDefaultDisplayPic(){
	$.getJSON(
		"changDefaultDisplayPic",
		{
			picture:$("#paticipatePicture")[0].src,
			id:$("#hiddenparticipateid").val(),
			type:$("#hiddenparticipatetype").val()
		},
		function(data){
			if(data.flag==0) //alert("无需修改");
				{
				$.weeboxs.open('无需修改!', {
					title:'提示',
					timeout:5,
					showCancel:false,
					okBtnName: '确定',
				});
				}
			if(data.flag==1) //alert('修改成功');
				{
				$.weeboxs.open('修改成功!', {
					title:'提示',
					timeout:5,
					showCancel:false,
					okBtnName: '确定',
				});
				}
		}
	);
	//window.location.href="changDefaultDisplayPic.action?picture="+$("#paticipatePicture")[0].src+"&&id="+$("#hiddenparticipateid").val()+"&&type="+$("#hiddenparticipatetype").val();
}

$(document).ready(function(){
	$("#uploadPic").dialog({
		autoOpen : false,
		module : true,
		width : 380,
		title:"上传图片",
		overlay : {
			opacity : 0.5,
			background : "black",
			overflow : 'auto'
		},
		modal : true,
		hide : "fadeout",
		module : true
	});
});

function uploaddata(){
	$("#uploadPic").dialog("open");
}
function gotoparticipate(id,type){
	$.getJSON("gotoParticipate.action",{id:id,type:type},function(data){
		if(data.result==1){
			//alert("分享成功");
			$.weeboxs.open('分享成功!', {
				title:'提示',
				timeout:5,
				showCancel:false,
				okBtnName: '确定',
			});
			window.location.href="showHomePage.action?recommendTime=1";
		}else{
			//alert("您已经分享");
			$.weeboxs.open('您已经分享!', {
				title:'提示',
				timeout:5,
				showCancel:false,
				okBtnName: '确定',
			});
			window.location.href="showHomePage.action?recommendTime=365";
		}
	});

}










